package javaapplication3;

import javax.swing.JOptionPane;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
public class TomSoftMain extends javax.swing.JFrame {

    ObjetMain objetSys;
    ZCorpMain zcorpSys;
    SolidscapeMain solidscapeSys;
    PendingJobs pendingSys;
    Student_Submission studentSys;
    boolean show;
    String PASS = "ForwardMotion";

    public TomSoftMain() {
        initComponents();
        this.setResizable(false);
        setPrintersVisible(false);
        studentSubmissionButton.setVisible(false);
        objetSys = new ObjetMain();
        zcorpSys = new ZCorpMain();
        solidscapeSys = new SolidscapeMain();
        pendingSys = new PendingJobs();
        studentSys = new Student_Submission();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane2 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        studentSubmissionButton = new javax.swing.JButton();
        submitButton = new javax.swing.JButton();
        zcorpButton = new javax.swing.JButton();
        solidscapeButton = new javax.swing.JButton();
        AdminButton = new javax.swing.JButton();
        openProjectsButton = new javax.swing.JButton();
        objetButton = new javax.swing.JButton();
        settingsButton = new javax.swing.JButton();
        ReportsButton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(jList1);

        jTextArea1.setEditable(false);
        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setText("Art 101-001\nArt 201-002\nArt 401-004\nArt 501-005\nArt 601-006\nArt 701-007\nArt 801-009");
        jScrollPane1.setViewportView(jTextArea1);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("TomSoft");
        setMinimumSize(new java.awt.Dimension(545, 350));
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        studentSubmissionButton.setText("Submit");
        studentSubmissionButton.setPreferredSize(new java.awt.Dimension(417, 417));
        studentSubmissionButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                studentSubmissionButtonActionPerformed(evt);
            }
        });
        getContentPane().add(studentSubmissionButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 150, 130, 30));

        submitButton.setText("Student");
        submitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submitButtonActionPerformed(evt);
            }
        });
        getContentPane().add(submitButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 140, 150, 30));

        zcorpButton.setText("ZCorp");
        zcorpButton.setToolTipText("");
        zcorpButton.setPreferredSize(new java.awt.Dimension(417, 417));
        zcorpButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                zcorpButtonActionPerformed(evt);
            }
        });
        getContentPane().add(zcorpButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 90, 130, 30));

        solidscapeButton.setText("Solidscape");
        solidscapeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                solidscapeButtonActionPerformed(evt);
            }
        });
        getContentPane().add(solidscapeButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 170, 130, 30));

        AdminButton.setText("Administrator");
        AdminButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AdminButtonActionPerformed(evt);
            }
        });
        getContentPane().add(AdminButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 190, 150, 30));

        openProjectsButton.setText("Projects");
        openProjectsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                openProjectsButtonActionPerformed(evt);
            }
        });
        getContentPane().add(openProjectsButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 40, 130, 30));

        objetButton.setText("Objet");
        objetButton.setPreferredSize(new java.awt.Dimension(417, 417));
        objetButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                objetButtonActionPerformed(evt);
            }
        });
        getContentPane().add(objetButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 130, 130, 30));

        settingsButton.setText("Settings");
        settingsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                settingsButtonActionPerformed(evt);
            }
        });
        getContentPane().add(settingsButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 260, 130, 30));

        ReportsButton.setText("Reports");
        ReportsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ReportsButtonActionPerformed(evt);
            }
        });
        getContentPane().add(ReportsButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 220, 130, 30));

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/javaapplication3/Main medium5.png"))); // NOI18N
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 540, 350));

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void solidscapeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_solidscapeButtonActionPerformed
        // TODO add your handling code here:
        solidscapeSys.SolidscapeMainStart();
        dispose();
    }//GEN-LAST:event_solidscapeButtonActionPerformed

    private void studentSubmissionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_studentSubmissionButtonActionPerformed
        // TODO add your handling code here:       
        studentSys.studentSubmissionStart();
        dispose();
    }//GEN-LAST:event_studentSubmissionButtonActionPerformed

    private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed
        setPrintersVisible(false);
        studentSubmissionButton.setVisible(true);

    }//GEN-LAST:event_submitButtonActionPerformed

    private void openProjectsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openProjectsButtonActionPerformed
        // TODO add your handling code here:
        pendingSys.PendingJobsStart();
        dispose();
    }//GEN-LAST:event_openProjectsButtonActionPerformed

    private void zcorpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zcorpButtonActionPerformed
        // TODO add your handling code here:
        zcorpSys.ZCorpMainStart();
        dispose();
    }//GEN-LAST:event_zcorpButtonActionPerformed

    private void AdminButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AdminButtonActionPerformed
        String password = JOptionPane.showInputDialog(new java.awt.Frame(), "Enter Admin Password:");
        if (password.equals(PASS)) {
            studentSubmissionButton.setVisible(false);
            setPrintersVisible(true);
        } else {
            JOptionPane.showMessageDialog(new java.awt.Frame(), "Incorrect password! Access Denied!");
        }
    }//GEN-LAST:event_AdminButtonActionPerformed

    private void objetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_objetButtonActionPerformed
        // TODO add your handling code here:
        objetSys.ObjetMainStart();
        dispose();
    }//GEN-LAST:event_objetButtonActionPerformed

    private void ReportsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ReportsButtonActionPerformed
        // TODO add your handling code here:
        Reports reports = new Reports();
        reports.ReportsPage();
        dispose();
    }//GEN-LAST:event_ReportsButtonActionPerformed

    private void settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {
        adminSettings ad = new adminSettings();
        ad.setVisible(true);
        dispose();
    }

    public void setPrintersVisible(boolean isVisible) {
        settingsButton.setVisible(isVisible);
        openProjectsButton.setVisible(isVisible);
        zcorpButton.setVisible(isVisible);
        solidscapeButton.setVisible(isVisible);
        objetButton.setVisible(isVisible);
        ReportsButton.setVisible(isVisible);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());

                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TomSoftMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>

        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TomSoftMain().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AdminButton;
    private javax.swing.JButton ReportsButton;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JButton objetButton;
    private javax.swing.JButton openProjectsButton;
    private javax.swing.JButton settingsButton;
    private javax.swing.JButton solidscapeButton;
    public static javax.swing.JButton studentSubmissionButton;
    private javax.swing.JButton submitButton;
    private javax.swing.JButton zcorpButton;
    // End of variables declaration//GEN-END:variables
}
